﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BLL;

public partial class Reprb_Cydrb : System.Web.UI.Page
{
    string strApp = "";
    public static string repName = "";
    public string bmp = "";
    int unit = 1;
    BLL.BLLRep br = new BLLRep();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["repName"].ToString() == "hx")
        {
            repName = "化学报表";
        }

        if (Request.QueryString["unit"].ToString() == "1")
        {
            unit = 1;
            bmp = "1hxrb.bmp";
        }
        else
        {
            unit = 2;
            bmp = "2hxrb.bmp";
        }
        if (!IsPostBack)
        {
            DateTime dt = System.DateTime.Now;

            this.Date1.Value = dt.AddDays(-0).ToString("yyyy-MM-dd");

            strApp = br.RetTableByHourHBByHX(repName, unit, DateTime.Parse(this.Date1.Value));

            this.show.InnerHtml = strApp;
        }
    }

    protected void btnChaXun_Click(object sender, EventArgs e)
    {
        DateTime dtInput = Convert.ToDateTime(this.Date1.Value);

        strApp = br.RetTableByHourHBByHX(repName, unit, dtInput);

        this.show.InnerHtml = strApp;
    }

    protected void btnPre_Click(object sender, EventArgs e)
    {
        //Response.Write("Pre");

        DateTime dtInput = Convert.ToDateTime(this.Date1.Value).AddDays(-1);

        this.Date1.Value = Convert.ToDateTime(this.Date1.Value).AddDays(-1).ToString("yyyy-MM-dd");

        strApp = br.RetTableByHourHBByHX(repName, unit, dtInput);

        this.show.InnerHtml = strApp;
    }

    protected void btnNext_Click(object sender, EventArgs e)
    {
        //Response.Write("Next");
        DateTime dtInput = Convert.ToDateTime(this.Date1.Value).AddDays(+1);

        this.Date1.Value = Convert.ToDateTime(this.Date1.Value).AddDays(+1).ToString("yyyy-MM-dd");

        strApp = br.RetTableByHourHBByHX(repName, unit, dtInput);

        this.show.InnerHtml = strApp;
    }
}
